#include "argumentspage.h"

std::string argumentsPage::valid_arguments() {
  std::string astring = "";
  QList<QObject *> children_of_page = this->findChildren<QObject *>();
  for (int i = 0; i < children_of_page.size(); ++i) {
    if (children_of_page[i] && !children_of_page[i]->objectName().isEmpty() &&
        children_of_page[i]->property("visible").toBool()) {
      if (strstr(children_of_page[i]->metaObject()->className(),
                 "FormComboBoxDelegate")) {
        astring += " --";
        astring += children_of_page[i]
                       ->property("objectName")
                       .toString()
                       .toStdString();
        astring += "=";
        astring += children_of_page[i]
                       ->property("currentIndex")
                       .toString()
                       .toStdString();
      }
      if (strstr(children_of_page[i]->metaObject()->className(),
                 "FormTextFieldDelegate")) {
        astring += " --";
        astring += children_of_page[i]
                       ->property("objectName")
                       .toString()
                       .toStdString();
        astring += "=";
        astring +=
            children_of_page[i]->property("text").toString().toStdString();
      }
    }
  }
  return astring;
}
